---
title: Script Loader
description: Load scripts based on consent. Used to load scripts that are not necessary for the user's consent, such as analytics scripts.
lastModified: 2025-09-19

availableIn:
  - framework: 'javascript'
    url: '/docs/frameworks/javascript/script-loader'
    title: 'JavaScript'
  - framework: 'next'
    url: '/docs/frameworks/next/script-loader'
    title: 'Next.js'
  - framework: 'react'
    url: '/docs/frameworks/react/script-loader'
    title: 'React'
---

<import>./shared/script-loader.mdx#overview</import>

<import>./shared/script-loader.mdx#tracking-blocker</import>

## Implementation

```ts
import { configureConsentManager } from 'c15t';
import { googleTagManager } from '@c15t/scripts/google-tag-manager';

const c15t = configureConsentManager({
  scripts: [
    {
      id: 'example',
      src: 'https://analytics.example.com/script.js',
      category: 'analytics',
    },
    googleTagManager({
      id: 'GTM-XXXXXXX',
    }), // We can also use the prebuilt script
  ]
});
```

<import>./shared/script-loader.mdx#prebuilt-scripts</import>

<import>./shared/script-loader.mdx#scripts-table</import>

<import>./shared/script-loader.mdx#always-load</import>

## Types

<import>./shared/script-loader.mdx#script-type</import>
